2 Problem: C -Life on Mars?
3 Author: Andrés Mejía-Posada
4 (http://blogaritmo.factorcomun.org)
29 #define D(x) cout << #x " is " << x << endl
32 //assert(freopen("life.in", "r", stdin) != NULL);
34 while (getline(cin
, line
) && line
!= "0"){
37 stringstream
sin(line
);
38 while (sin
>> x
) s
.push_back(x
);
42 for (int i
=0; i
<n
; ++i
){
44 cout
<< "Message hacked by the Martians!!!\n";
49 for (int i
=0; i
<s
.size(); ++i
){
52 s
.erase(s
.begin() + i
);
56 for (int i
=0; i
<n
; ++i
){
57 if (t
[i
] != -1) cout
<< (i
>0?" ":"") << t
[i
];
58 else (cout
<< (i
>0?" ":"") << s
[0]), s
.erase(s
.begin());